package com.kanq.handler;

import com.kanq.pojo.context.ChatContext;
import com.kanq.service.KanqAiPromptService;

public class TemplateHandler implements ChatHandler {
    private final KanqAiPromptService promptService;
    private String chatDirectlyTemplate;

    public TemplateHandler(KanqAiPromptService promptService) {
        this.promptService = promptService;
    }

    @Override
    public void handle(ChatContext context) {
        if (chatDirectlyTemplate == null) {
            chatDirectlyTemplate = promptService.getByName("chat_directly");
        }
        context.setChatDirectlyTemplate(chatDirectlyTemplate);
    }
}
